New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

puqeue

Package Overview
Dependencies
Maintainers
0
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

puqeue

A small queue for promises.

  • 1.1.14
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
126
increased by2420%
Maintainers
0
Weekly downloads
 
Created
Source

puqeue

Introduction

A small JS library for queuing promises.

Use

const Puqeue = require('puqeue');

const queue = new Puqeue();

await queue.add(async () {
    // My todo
});

You can await multiple promises in a queue by using Promise.all.

await Promise.all(
    queue.add(async () {
        console.info(1);
    }),
    queue.add(async () {
        console.info(3);
    }, { priority: 100 }),
    queue.add(async () {
        console.info(2);
    })
);

The above example will execute one at the time, but second operation will execute last due to priority.

Default priority is 10.

Options

You specify the maximum number of concurrent promises run with an option.

new Puqeue({ maxOperationCount: 2 });

Use 0 to indicate no limit (default is 1).

LICENSE

See LICENSE.

Keywords

FAQs

Package last updated on 23 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc